Subject: Re: BOOPSI Class Names
From: [email-masked] (Christoph Feck IRZ)
Date: Mon, 9 May 1994 12:39:31 GMT
Newsgroups: comp.sys.amiga.programmer

In article <[email-masked]>, [email-masked] (Mark A. Thomas) writes:
> In article <[email-masked]>,
> Christoph Feck IRZ <[email-masked]> wrote:
> >The solution is simple:  Make your library have _one_ LVO (let's
> >call it GetClass() here).
> 
> Yes, this is a nice solution...  The only reason that I can come up
> with for this not being the best solution is that it will take 3
> steps to get a gadget (OpenClass(), GetClass(), and CreateObject()),
> as opposed to 2 (OpenClass(), CreateObject()).  However it does have
> the advantage of not having to wait for Commodore to approve of a
> public class name.  I guess I'll use this now, and when I get
> approval I'll let you do it either way.  Thanks.

There is another reason:  Speed!  Say you want to create 100
button objects in your window, the OS would search 100 times
the public class list.  When more and more people add classes
to this list, the startup time of your program increases
proportional to O(n*m).  But if you already have a class pointer
(_AND_ it is guarantueed to stay valid as long as the library
is openend), you can just do a simple CoerceMethod call:

  newobj = CoerceMethod(class, class, OM_NEW, attributes);

This directly jumps into the class dispatcher.  The only
reason the Intuition call NewObjectA exists, is because
of locking the class to prevent it from unloading while
the object is being created (semaphores et al.).

> Yes, certainly.  My goal was to always follow the Commodore
> standard, that's why I'm a bit hesitant about GetClass().

Actually, datatype classes also have this LVO at offset -30.
That's where I got the idea :)

3k// Christoph Feck, TowerSystems - BOOPSI Class Development
\X/ Amiga - Intuition inside.